<?php /*
	*/ ?>
<?php include("system/config.inc.php");
$donotinclude = 1;
// IF admin is not logged in then it will redirect to the adminlogin page.
if(!isset($_SESSION['adminuserid']))
{
	header("location:index.php?msg=logfirst");
	die();
}

if(isset($_REQUEST['Submit']) && trim($_REQUEST['Submit']) == "Update")	{
				$name=mysql_real_escape_string($_REQUEST['sname']);
				$oname=mysql_real_escape_string($_REQUEST['oname']);
				$oemail=mysql_real_escape_string($_REQUEST['oemail']);
				$from=mysql_real_escape_string($_REQUEST['fromemail']);
				$coun=mysql_real_escape_string($_REQUEST['country']);
				$zone=mysql_real_escape_string($_REQUEST['zone']);
				$orderemail=mysql_real_escape_string($_REQUEST['orderemail']);
				$sarea=mysql_real_escape_string($_REQUEST['sarea']);
				$postcode=mysql_real_escape_string($_REQUEST['postcode']);
				$wtitle=mysql_real_escape_string($_REQUEST['welcometitle']);
				$wmess=mysql_real_escape_string($_REQUEST['welcommess']);
				$sql_upd ="UPDATE tblmystore SET  
						varstorename = '$name',
						varstoreownername='$oname',
						varowneremail='$oemail',
						varfromemail='$from',
						varcountry='$coun',
						varzone='$zone',
						varpostcode='$postcode',
						varsendordertoemail='$orderemail',
						varstoreaddsandphone='$sarea',
						varwelcometitle='$wtitle',
						txtwelcomemess='$wmess'";
			$result = $obj_db->edit($sql_upd);
			header("location:store.php?msg=edit");
}		

		$p_name = "";
		$p_oname = "";
		$p_oemail = "";
		$p_ofemail = "";
		$p_count = "";
		$p_zone = "";
		$p_sende = "";
		$p_add = "";
		$p_wtitle="";
		$p_wmess="";
		$p_postcode="";
		$action=1;
		
		$sql = "select * from tblmystore";
		$result = $obj_db->select($sql);
		if(count($result)<=0) {
			echo " No Record Found!<br>";
		}
		if($result)
		{
			foreach($result as $row)
			{
				$p_name = stripslashes($row['varstorename']);	   
		   		$p_oname = stripslashes($row['varstoreownername']);
				$p_oemail = stripslashes($row['varowneremail']);
				$p_ofemail = stripslashes($row['varfromemail']);
				$p_count = stripslashes($row['varcountry']);
				$p_zone = stripslashes($row['varzone']);
				$p_postcode = stripslashes($row['varpostcode']);
				$p_sende = stripslashes($row['varsendordertoemail']);
				$p_add = stripslashes($row['varstoreaddsandphone']);
				$p_wtitle=stripslashes($row['varwelcometitle']);
				$p_wmess=stripslashes($row['txtwelcomemess']);
			}
		}
		
		
?>
<?php include("inc/header.php");?>
<script type="text/javascript" src="js/tiny_mce.js"></script>
<script type="text/javascript">
	// O2k7 skin (silver)
	tinyMCE.init({
		// General options
		mode : "exact",
		elements : "welcommess",
		theme : "advanced",
		skin : "o2k7",
		skin_variant : "black",
		plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

		// Theme options
		theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
		theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_resizing : false
	});
</script>
<body>
<table width="80%" border="0" align="center" cellpadding="0" cellspacing="1" class="middlebackground">
  <tr>
    <td colspan="3" valign="top" align="center"><?php include(INC."top.inc.php");?></td>
  </tr>
  <tr>
    <td width="1%">&nbsp;</td>
    <td width="97%"><form action="" method="post" enctype="multipart/form-data" name="store">

      <table width="75%" border="0" align="center" cellpadding="2" cellspacing="2" class="border">
        <tr class="bg1">
          <td colspan="5" align="center"><strong>Store...</strong></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td align="left">&nbsp;</td>
          <td>&nbsp;</td>
          <td align="right">(* All fields are Required)</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td width="2%">&nbsp;</td>
          <td width="27%" align="right" class="sltimg">*Store Name</td>
          <td width="2%">:</td>
          <td width="63%" align="left"><label>
            <input name="sname" type="text" id="sname" value="<?php echo $p_name;?>" />
          </label></td>
          <td width="6%">&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td align="right" class="sltimg">*Owner Name</td>
          <td>:</td>
          <td align="left"><input name="oname" type="text" id="oname" value="<?php echo $p_oname;?>" /></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td align="right" class="sltimg">*Owner E-Mail </td>
          <td>:</td>
          <td align="left"><input name="oemail" type="text" id="oemail" value="<?php echo $p_oemail;?>" /></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td align="left">&nbsp;</td>
          <td align="right" class="sltimg">*From E-Mail</td>
          <td align="left">:</td>
          <td align="left"><input name="fromemail" type="text" id="fromemail" value="<?php echo $p_ofemail;?>" /></td>
          <td align="left">&nbsp;</td>
        </tr>
        <tr>
          <td align="left">&nbsp;</td>
          <td align="right" class="sltimg">*Country</td>
          <td align="left">:</td>
          <td align="left"><input name="country" type="text" id="country" value="<?php echo $p_count;?>" /></td>
          <td align="left">&nbsp;</td>
        </tr>
        <tr>
          <td align="left">&nbsp;</td>
          <td align="right" class="sltimg">*City</td>
          <td align="left">:</td>
          <td align="left"><input name="zone" type="text" id="zone" value="<?php echo $p_zone;?>" /></td>
          <td align="left">&nbsp;</td>
        </tr>
		 <tr>
          <td align="left">&nbsp;</td>
          <td align="right" class="sltimg">*Postcode</td>
          <td align="left">:</td>
          <td align="left"><input name="postcode" type="text" id="postcode" value="<?php echo $p_postcode;?>" /></td>
          <td align="left">&nbsp;</td>
        </tr>
        <tr>
          <td align="left">&nbsp;</td>
          <td align="right" class="sltimg">*Order E-Mail </td>
          <td align="left">:</td>
          <td align="left"><input name="orderemail" type="text" id="orderemail" value="<?php echo $p_sende;?>" /></td>
          <td align="left">&nbsp;</td>
        </tr>
        <tr>
          <td align="left">&nbsp;</td>
          <td align="right" valign="top" class="sltimg">*Store Address </td>
          <td align="left" valign="top">:</td>
          <td align="left"><label>
            <textarea name="sarea" id="sarea"><?php echo $p_add;?></textarea>
          </label></td>
          <td align="left">&nbsp;</td>
        </tr>
        <tr>
          <td align="left">&nbsp;</td>
          <td align="right">Welcome title </td>
          <td align="left">&nbsp;</td>
          <td align="left"><input name="welcometitle" type="text" id="welcometitle" value="<?php echo $p_wtitle;?>" /></td>
          <td align="left">&nbsp;</td>
        </tr>
        <tr>
          <td align="left">&nbsp;</td>
          <td align="right" valign="top">Welcome message </td>
          <td align="left" valign="top">:</td>
          <td align="left"><textarea name="welcommess" rows="40" id="welcommess"><?php echo $p_wmess;?>
          </textarea></td>
          <td align="left">&nbsp;</td>
        </tr>
        <tr>
          <td colspan="5" align="left">&nbsp;</td>
        </tr>
        <tr>
          <td colspan="5" align="center"><input name="Submit" type="submit" class="btn" id="submit" value="Update" /></td>
        </tr>
        <tr>
          <td colspan="5" align="center">&nbsp;</td>
        </tr>
      </table>
            </form>
    </td>
    <td width="2%">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="3" align="center">&nbsp;</td>
  </tr>
</table>

</body>
</html>
